<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2020/12/25
  Time: 2:55 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<ul class="pagination">
    <c:if test="${pageInfo.pageNum<=1}">
        <li class="disabled"><a>&laquo;</a></li>
    </c:if>

    <c:if test="${pageInfo.pageNum>1}">
        <li><a href="javascript:goNext(${pageInfo.pageNum-1})">&laquo;</a></li>
    </c:if>


    <c:if test="${pageInfo.pageNum+2<=pageInfo.pages}">
        <c:set var="startPage" value="${pageInfo.pageNum}"></c:set>
    </c:if>

    <c:if test="${pageInfo.pageNum+2>pageInfo.pages}">
        <c:set value="${pageInfo.pages-2}" var="startPage"></c:set>
    </c:if>

    <c:if test="${pageInfo.pageNum+2<pageInfo.pages}">
        <c:set var="endPage" value="${pageInfo.pageNum+2}"></c:set>
    </c:if>

    <c:if test="${pageInfo.pageNum+2>=pageInfo.pages}">
        <c:set var="endPage" value="${pageInfo.pages}"></c:set>
    </c:if>

    <c:forEach begin="${startPage<=0?1:startPage}" end="${endPage}" var="v">

        <c:if test="${pageInfo.pageNum == v}">
            <li class="active"><a href="javascript:goNext(${v})">${v}</a></li>
        </c:if>

        <c:if test="${pageInfo.pageNum != v}">
            <li><a href="javascript:goNext(${v})">${v}</a></li>
        </c:if>

    </c:forEach>

    <c:if test="${pageInfo.pageNum>=pageInfo.pages}">
        <li class="disabled"><a>&raquo;</a></li>
    </c:if>

    <c:if test="${pageInfo.pageNum<pageInfo.pages}">
        <li><a href="javascript:goNext(${pageInfo.pageNum+1})">&raquo;</a></li>
    </c:if>


    <li><a href="#">当前页${pageInfo.pageNum}/${pageInfo.pages}总页</a></li>
<%--    <li><a style="padding: 0;border: 0"><input type="number" class="form-control"> </a></li>--%>
<%--    <li><a style="padding: 0;border: 0">--%>
<%--        <select  class="form-control" >--%>
<%--            <option value="-1">===每页显示条数===</option>--%>
<%--            <option value="2">2</option>--%>
<%--            <option value="5">5</option>--%>
<%--            <option value="6">6</option>--%>
<%--            <option value="10">10</option>--%>
<%--        </select>--%>
    </a></li>
</ul>
<script>
    function goNext(num){
        let name = $("#name_input").val();
        let type_id = $("#type_select").val();



            $("#outer").load("/product/page_content",{pageNum:num,name:name,typeId:type_id})


       // $("#outer").load("/mvc/product/page_content",{pageNum:num,name:name,typeId:type_id})

        //window.location="/mvc/product/index?pageNum="+num+"&name="+name+"&typeId="+type_id;
    }
</script>